import React from 'react';
import { Table } from 'antd';

const TAG_MAP = {
    0: <span style={{ color: '#F5222D' }}>不合格</span>,
    1: '合格'
};

const PerformanceTable = ({ dataSource = [] }) => {
    const columns = [
        {
            title: '考核月份',
            dataIndex: 'performanceDate'
        },
        {
            title: '绩效得分',
            dataIndex: 'score'
        },
        {
            title: '绩效等级',
            dataIndex: 'level'
        },
        {
            title: '考核结果',
            dataIndex: 'result',
            render: text => TAG_MAP[text]
        }
    ];

    return (
        <Table
            rowKey="id"
            bordered
            dataSource={dataSource}
            columns={columns}
            pagination={false}
            scroll={{ x: 'max-content' }}
        />
    );
};

export default PerformanceTable;
